package com.iflytek.cosmo.ocr.web.controller;

import com.iflytek.cosmo.ocr.common.exception.VersionInfoOutputExceptionAbstract;
import com.iflytek.cosmo.ocr.service.VersionInfoService;
import com.iflytek.cosmo.ocr.model.domain.VersionInfoOutput;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 版本基础信息控制器
 *
 * @author xqxia3
 * @date 2018/04/22
 */
@RestController
@RequestMapping("/service/v1")
public class VersionInfoController {
    @Autowired
    private VersionInfoService versionInfoService;

    /**
     * 根据项目名称获取版本列表
     *
     * @param projectName
     * @param projectProfile
     * @return
     */
    @GetMapping("/app/{projectName}/profile")
    public List<VersionInfoOutput> versionList(@PathVariable("projectName") String projectName)
            throws VersionInfoOutputExceptionAbstract {
        List<VersionInfoOutput> resultList = versionInfoService.queryVersionInfoList(projectName);
        return resultList;
    }
}
